import java.util.*;
import java.util.regex.*;
import java.text.*;
import java.math.*;
import java.awt.geom.*;

public class CorrectMultiplicationTwo {
	public int getMinimum(int a, int b, int c) {
		int mmin = Integer.MAX_VALUE;
		for (int i = 1; i <= 3000000; i++) {
			for (int j = 1; i * j <= 3000000; j++) {
				mmin = Math.min(mmin, Math.abs(i - a) + Math.abs(j - b)
						+ Math.abs(c - i * j));
			}
		}
		return mmin;
	}
	// <%:testing-code%>
}
// Powered by [KawigiEdit] 2.0!